package com.woupla.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Dimitri Lebel
 */
@Entity
@Table(name = "ExceptionPlaning")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ExceptionPlaning.findAll", query = "SELECT e FROM ExceptionPlaning e"),
    @NamedQuery(name = "ExceptionPlaning.findById", query = "SELECT e FROM ExceptionPlaning e WHERE e.id = :id"),
    @NamedQuery(name = "ExceptionPlaning.findByDateDebut", query = "SELECT e FROM ExceptionPlaning e WHERE e.dateDebut = :dateDebut"),
    @NamedQuery(name = "ExceptionPlaning.findByDateFin", query = "SELECT e FROM ExceptionPlaning e WHERE e.dateFin = :dateFin"),
    @NamedQuery(name = "ExceptionPlaning.findByDescriptif", query = "SELECT e FROM ExceptionPlaning e WHERE e.descriptif = :descriptif")})
public class ExceptionPlaning implements Serializable {
    
    /**
	 * 
	 */
	private static final long serialVersionUID = 6637916919936655263L;
	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "dateDebut")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateDebut;
    @Basic(optional = false)
    @NotNull
    @Column(name = "dateFin")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateFin;
    @Size(max = 200)
    @Column(name = "descriptif")
    private String descriptif;
    @JoinColumn(name = "Company_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Company company;
    @JoinColumn(name = "User_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private User user;

    public ExceptionPlaning() {
    }

    public ExceptionPlaning(Integer id) {
        this.id = id;
    }

    public ExceptionPlaning(Integer id, Date dateDebut, Date dateFin) {
        this.id = id;
        this.dateDebut = dateDebut;
        this.dateFin = dateFin;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getDateDebut() {
        return dateDebut;
    }

    public void setDateDebut(Date dateDebut) {
        this.dateDebut = dateDebut;
    }

    public Date getDateFin() {
        return dateFin;
    }

    public void setDateFin(Date dateFin) {
        this.dateFin = dateFin;
    }

    public String getDescriptif() {
        return descriptif;
    }

    public void setDescriptif(String descriptif) {
        this.descriptif = descriptif;
    }

    public Company getCompanyid() {
        return company;
    }

    public void setCompanyid(Company companyid) {
        this.company = companyid;
    }

    public User getUserid() {
        return user;
    }

    public void setUserid(User userid) {
        this.user = userid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ExceptionPlaning)) {
            return false;
        }
        ExceptionPlaning other = (ExceptionPlaning) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.rds.model.ExceptionPlaning[ id=" + id + " ]";
    }
    
}
